Castigliano's Second Theorem